#[no_mangle]
fn ssqiu() -> String {
    let url: &str = "https://datachart.500.com/ssq/history/newinc/history.php?start=03001";
    match reqwest::blocking::get(url).is_ok(){
        true => {
                let mut data: String = reqwest::blocking::get(url).unwrap().text().unwrap();
                let beta_offset: usize = data.find("><td class=\"t_cfont2").unwrap_or(data.len());
                data.replace_range(..beta_offset, "");
                let beta_offset: usize = data.find("</tbody>").unwrap_or(data.len());
                data.replace_range(beta_offset.., "");
                let data: String = data.replace("><td class=\"t_cfont2\">", "");
                let data: String = data.replace("><td class=\"t_cfont4\">", "");
                let vdata: Vec<&str> = data.split("</td").collect();
                let mut red_balls1: Vec<&str> = vec![];
                let mut red_balls2: Vec<&str> = vec![];
                let mut red_balls3: Vec<&str> = vec![];
                let mut red_balls4: Vec<&str> = vec![];
                let mut red_balls5: Vec<&str> = vec![];
                let mut red_balls6: Vec<&str> = vec![];
                let mut blue_balls: Vec<&str> = vec![];
                for i in (0..vdata.len()).step_by(17) {
                    red_balls1.push(vdata[i + 0]);
                    red_balls2.push(vdata[i + 1]);
                    red_balls3.push(vdata[i + 2]);
                    red_balls4.push(vdata[i + 3]);
                    red_balls5.push(vdata[i + 4]);
                    red_balls6.push(vdata[i + 5]);
                    blue_balls.push(vdata[i + 6]);
                }
                let temp1: std::iter::Zip<std::vec::IntoIter<&str>, std::vec::IntoIter<&str>> = red_balls1
                    .clone()
                    .into_iter()
                    .zip(red_balls2.clone().into_iter());
                let temp2: std::iter::Zip<std::vec::IntoIter<&str>, std::vec::IntoIter<&str>> = red_balls3
                    .clone()
                    .into_iter()
                    .zip(red_balls4.clone().into_iter());
                let temp3: std::iter::Zip<std::vec::IntoIter<&str>, std::vec::IntoIter<&str>> = red_balls5
                    .clone()
                    .into_iter()
                    .zip(red_balls6.clone().into_iter());
                let mut red_balls1_2: Vec<(&str, &str)> = vec![];
                let mut red_balls3_4: Vec<(&str, &str)> = vec![];
                let mut red_balls5_6: Vec<(&str, &str)> = vec![];
                for i in temp1 {
                    red_balls1_2.push(i)
                }
                for i in temp2 {
                    red_balls3_4.push(i)
                }
                for i in temp3 {
                    red_balls5_6.push(i)
                }
                let rb12: Vec<String> = statistics(red_balls1_2);
                let rb34: Vec<String> = statistics(red_balls3_4);
                let rb56: Vec<String> = statistics(red_balls5_6);
                let bb: Vec<String> = statistics(blue_balls);
                let rb1: Vec<String> = statistics(red_balls1);
                let rb2: Vec<String> = statistics(red_balls2);
                let rb3: Vec<String> = statistics(red_balls3);
                let rb4: Vec<String> = statistics(red_balls4);
                let rb5: Vec<String> = statistics(red_balls5);
                let rb6: Vec<String> = statistics(red_balls6);
                let final_result: String = format!(">红球1、2号组合|3、4号组合|5、6号组合\n{} | {} | {}\n{} | {} | {}\n{} | {} | {}\n{} | {} | {}\n{} | {} | {}
\n>蓝球:{} | {} | {} | {} | {}\n
>红球1号|红球2号|红球3号|红球4号|红球5号|红球6号
{} | {} | {} | {} | {} | {}
{} | {} | {} | {} | {} | {}
{} | {} | {} | {} | {} | {}
{} | {} | {} | {} | {} | {}
{} | {} | {} | {} | {} | {}",
                rb12[0],rb34[0],rb56[0],
                rb12[1],rb34[1],rb56[1],
                rb12[2],rb34[2],rb56[2],
                rb12[3],rb34[3],rb56[3],
                rb12[4],rb34[4],rb56[4],
                bb[0],bb[1],bb[2],bb[3],bb[4],
                rb1[0],rb2[0],rb3[0],rb4[0],rb5[0],rb6[0],
                rb1[1],rb2[1],rb3[1],rb4[1],rb5[1],rb6[1],
                rb1[2],rb2[2],rb3[2],rb4[2],rb5[2],rb6[2],
                rb1[3],rb2[3],rb3[3],rb4[3],rb5[3],rb6[3],
                rb1[4],rb2[4],rb3[4],rb4[4],rb5[4],rb6[4]);
                let final_result: String = (final_result.replace("),", ":")).replace("\", \"", ",");
                let final_result: String = (final_result.replace("\",", ":")).replace(|c| c == '(' || c == ')' || c == '"', "");
                return final_result;
                }
        false => return String::from("发生错误,请检查网络连接"),
    }
}
fn statistics<T>(v: Vec<T>) -> Vec<String>
where
    T: Eq,
    T: std::hash::Hash,
    T: std::fmt::Debug + Copy,
{
    let temp: Vec<T> = v;
    let mut result: std::collections::HashMap<T, usize> = std::collections::HashMap::new();
    for n in temp.iter() {
        result
            .entry(*n)
            .and_modify(|count: &mut usize| *count += 1)
            .or_insert(1);
    }
    let mut result: Vec<_> = result.iter().collect();
    result.sort_by(|a: &(&T, &usize), b: &(&T, &usize)| b.1.cmp(a.1)); //按值的降序排序
    let mut return_value: Vec<String> = Vec::new();
    return_value.push(format!("{:?}", result[0]));
    return_value.push(format!("{:?}", result[1]));
    return_value.push(format!("{:?}", result[2]));
    return_value.push(format!("{:?}", result[3]));
    return_value.push(format!("{:?}", result[4]));
    return_value
}